﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication3
{
    public partial class TimerForm : Form
    {
        Boolean flag = false;
        public TimerForm()
        {
            InitializeComponent();
        }

        private void TimerForm_Load(object sender, EventArgs e)
        {
            pictureBox1.Image = Image.FromFile(@"D:\7788\老子儿子孙子.png");
           pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            //设置1秒
        
            //格式化时间 
            dateTimePicker1.Format = DateTimePickerFormat.Time;
            timer1.Interval = 1000;
            timer1.Start();

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (flag)
            {
                pictureBox1.Image = Image.FromFile(@"D:\7788\老子儿子孙子.png");
                flag = false;

            }else
            {
                pictureBox1.Image = Image.FromFile(@"D:\7788\动物工厂.png");
                flag = true;
            }
            dateTimePicker1.ResetText();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Start();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            timer1.Stop();
        }
    }
}
